<template>
	<yd-layout id='messageIncome' class=''>
		<div class="content">
			<yd-infinitescroll v-show='messageList.length>0' :callback="getMessageList" ref="infinitescrollDemo">
				<div class="list"  slot="list" v-for="item,index in messageList">
					<div class="list_header">
						<div class="header_left">
							<div class="header_img">
								<span v-if="item.status===0"></span>
								<img v-if="true" :src="item.icon" alt="" />
								<img v-else-if="index==1" src="../../assets/messageIncome_2.png" alt="" />
								<img v-else src="../../assets/messageIncome_3.png" alt="" />
							</div>
							<div class="header_left_lable c_size_34_48">{{item.title}}</div>
						</div>
						<div class="header_time ">{{item.newTime}}</div>
					</div>
					<div class="list_label c_size_30_42">{{item.content}}</div>
				</div>
					
				<!-- 数据全部加载完毕显示 -->
		        <span slot="doneTip">没有更多数据了~~</span>
		
		        <!-- 加载中提示，不指定，将显示默认加载中图标 -->
		        <!--<img slot="loadingTip" src="path/img/loading.svg"/>-->
			</yd-infinitescroll>
			<NoList v-show='messageList.length==0'>
				<img slot='img' src="../../assets/kong_1.png" alt="" />
			</NoList>
		</div>
		<yd-backtop></yd-backtop>
	</yd-layout>
</template>

<script>
	import {InfiniteScroll} from 'vue-ydui/dist/lib.rem/infinitescroll';
	import {BackTop} from 'vue-ydui/dist/lib.rem/backtop';
	export default{
		components:{
			[InfiniteScroll.name]:InfiniteScroll,
			[BackTop.name]:BackTop,
		},
		data(){
			return {
				messageList: [],
				pageNum:1,
				pageCount:10,
			}
		},
		created() {
		},
		watch: {
			
		},
		computed: {
			
		},
		mounted(){
			document.title='收入通知'
			this.getMessageList()
		},
		methods:{
			getMessageList(){
				this.$root.ajax({
					type:'get',
					name:'message/lst',
					params:{
						type:4,
						page:this.pageNum,
						count:this.pageCount,
					}
				}).then((d)=>{
					for(let a = 0 ; a<d.data.message_list.length;a++){
						d.data.message_list[a].newTime = this.$root.getDate(new Date(d.data.message_list[a].create_time*1000))
					}
					this.messageList = [...this.messageList, ...d.data.message_list];
                    if (this.messageList.length >= d.data.message_total ) {
                        /* 所有数据加载完毕 */
                        this.$refs.infinitescrollDemo.$emit('ydui.infinitescroll.loadedDone');
                        return;
                    }

                    /* 单次请求数据完毕 */
                    this.$refs.infinitescrollDemo.$emit('ydui.infinitescroll.finishLoad');

                    this.pageNum++;
				})
			},
		}
	}
</script>

<style lang="scss">
	@import './messageIncome.scss';
</style>